#define DEBUG
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int maxn=2000, maxm=2000, maxl=200, mods=1000000007;

bool mystrcmp(char *a, char *b) {
  return strcmp(a, b)<0;
}

int main() {
  freopen("prefix.in", "r", stdin);
  freopen("prefix.test.out", "w", stdout);

  static char *s[maxn+1], str[maxn+1][maxl+1];
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i=1; i<=n; i++) {
    s[i] = str[i];
  }
  for (int i=1; i<=n; i++) {
    scanf("%s", s[i]);
  }

  sort(s+1, s+n+1, mystrcmp);

  static long long f[maxm+1][maxl+1], sum[maxm+1][maxl+2];
  static int pos[maxn+1];
  for (int i=2; i<=n; i++) {
    for (pos[i]=0; s[i][pos[i]]!='\0' && s[i][pos[i]]==s[i-1][pos[i]]; pos[i]++);
  }
  int i;
  for (i=0; s[1][i]!='\0'; i++) {
    f[1][i] = 1;
  }
  for (; i>=0; i--) {
    sum[1][i] = (sum[1][i+1]+f[1][i])%mods;
  }

  for (int i=2; i<=n; i++) {
    int len=strlen(s[i]);
    for (int j=m; j>0; j--) {
      int k=len-1;
      // memset(f[i%2][j], 0, sizeof(f[i%2][j]));
      for (; k>=pos[i]; k--) {
	f[j][k] = sum[j-1][pos[i]];
      }
      sum[j][len] = 0;
      for (k=len-1; k>=0; k--) {
	sum[j][k] = (sum[j][k+1]+f[j][k])%mods;
      }
    }
  }

  printf("%lld", sum[m][0]);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
